package org.simplecrm.domain.customer;

import org.simplecrm.domain.event.Event;
import org.simplecrm.domain.region.Region;

import java.io.Serializable;
import java.util.List;

/**
 * Customer entity.
 */
public class Customer implements Serializable {

    private Integer id;
    private String name;
    private Region region;
    private float totalIncome;
    private List<Event> eventCollection;

    /**
     *
     */
    public Customer() {
    }

    /**
     * @param id
     */
    public Customer(Integer id) {
        this.id = id;
    }

    /**
     * @param id
     * @param name
     * @param region
     * @param totalIncome
     */
    public Customer(Integer id, String name, Region region, float totalIncome, List<Event> eventCollection) {

        setId(id);
        setName(name);
        setRegion(region);
        setTotalIncome(totalIncome);
        setEventCollection(eventCollection);
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Region getRegion() {
        return region;
    }

    public void setRegion(Region region) {
        this.region = region;
    }

    public float getTotalIncome() {
        return totalIncome;
    }

    public void setTotalIncome(float totalIncome) {
        this.totalIncome = totalIncome;
    }

    public List<Event> getEventCollection() {
        return eventCollection;
    }

    public void setEventCollection(List<Event> eventCollection) {
        this.eventCollection = eventCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Customer)) {
            return false;
        }
        Customer other = (Customer) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Customer{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", region=" + region +
                ", totalIncome=" + totalIncome +
                ", eventCollection=" + eventCollection +
                '}';
    }
}
